@extends('layouts.app')
@include('free.sidebar')
@section('content')
    <div class="content">
        <div class="row custom-invoice">
            <form method="get" action="{{ route('admin.free.index') }}">
                <div class="form-group col-md-2 col-sm-6 col-xs-10">
                    <input class="form-control" type="text" name="name" value="{{ $name }}" placeholder="用户昵称">
                </div>
                <div class="form-group col-md-2 col-sm-6 col-xs-10">
                    <input class="form-control" type="text" name="goods" value="{{ $goods }}" placeholder="商品名">
                </div>
                <div class="form-group col-md-2 col-sm-10 col-xs-10">
                    <button class="btn btn-success btn-ms" type="submit">搜索</button>
                </div>
            </form>
            <br />
            <table class="table table-striped table-hover">
                <thead>
                <tr>
                    <th>所属门店</th>
                    <th>商品名</th>
                    <th>用户</th>
                    <th>头像</th>
                    <th>订单ID</th>
                    <th>金额</th>
                    <th>已解锁金额</th>
                    <th>操作</th>
                </tr>
                </thead>
                <tbody>
                @foreach($data as $item)
                    <tr>
                        <td>{{ $shop->get($item->shop_id)->name }}</td>
                        <td>{{ $item->title }}</td>
                        <td>{{ $item->nickname }}</td>
                        <td>
                            <img src="{{ $item->avatar }}" width="30" />
                        </td>
                        <td>{{ $item->order_id }}</td>
                        <td>{{ $item->aim/100 }}</td>
                        <td>{{ $item->unlocked/100 }}</td>
                        <td>
                            <a class="btn btn-primary btn-xs" href="{{ route('admin.free.unlock', ['id' => $item->id]) }}"><i class="fa fa-list"></i> 解锁列表</a>
                        </td>
                    </tr>
                @endforeach
                </tbody>
            </table>
            {{ $data->appends(['name' => $name, 'goods' => $goods])->links() }}
        </div>
    </div>
@endsection
